package day05;

/**
 * @author yzg
 * @desc TODO
 * @date 2025/4/14
 */
public class IndexOfMaxElement {
    public static void main(String[] args) {
        int[] arr= {10,20,30,40,50,60};
        System.out.println(findMax(arr));
    }

    public static int findMax(int[] arr) {
        int max = arr[0];
        int maxIndex = 0;
        for (int i = 1; i < arr.length; i++) {
            if (arr[i] > max) {
                max = arr[i];
                maxIndex = i;
            }
        }
        return maxIndex;
    }
}
